<!--
 * @Author: jhw
 * @Date: 2025-08-05 10:22:40
 * @LastEditors: jhw
 * @LastEditTime: 2025-08-05 14:38:53
 * @Description: 标题编辑组件
-->
<template>
  <div key="id">
    <div class="mb-10px">标题内容</div>
    <el-input :placeholder="text" v-model="text" @update:modelValue="inputHandle" />
  </div>
</template>

<script setup lang="ts">
import type { UpdateStatus, VueComType } from '@/types';
import { inject, ref } from 'vue';

const props = defineProps<{
  status: string;
  isShow: boolean;
  configKey: string;
  editCom: VueComType;
  id: string;
}>();

const text = ref(props.status);
const updateStatus = inject<UpdateStatus>('updateStatus');

const inputHandle = (value: string) => {
  if (updateStatus) {
    updateStatus(props.configKey, value);
  } else {
    console.error('updateStatus is not found');
  }
};
</script>

<style scoped></style>
